import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import Layout from '@/layout/index.vue';

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'home',
        component: Layout,
        redirect: '/home',
        children: [
            {
                path: 'dashbod',
                component: () => import('@/views/dashbod/index.vue'),
                meta: {
                    title: '首页'
                }
            },
            {
                path: 'home',
                component: () => import('@/views/Home/HomeView.vue'),
                meta: {
                    title: '学生信息'
                },
                children: [
                    {
                        path: 'about',
                        component: () => import('@/views/AboutView.vue'),
                        meta: {
                            title: '关于'
                        }
                    }
                ]
            }
            // {
            //     path: 'about',
            //     component: () => import('@/views/AboutView.vue'),
            //     meta: {
            //         title: '关于'
            //     }
            // }
        ]
    },
    {
        path: '/login',
        name: 'login',
        component: () => import('@/views/Login.vue')
    }
    // webpack
    // vite
];

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
});

export default router;
